// pages/day_day_listen/sharelist/sharelist.js
var app = getApp();
Page({
  /**
   * 页面的初始数据
   */
  data: {
    clickhide:false,
    imgindex:0,
    imgreal:'../../../images/img4.png',
    imglist: ['../../../images/img4.png', '../../../images/img5.png', '../../../images/img6.png','../../../images/img7.png'],
    animationData: {},
    first:false,
    myshare:false,
    shareList: []
  },
  shareDetailBindTap: function (e) {
    var id = e.currentTarget.dataset.id;
    console.log(id)
    wx.navigateTo({
      url: "../../my/my_share/sharing_details/sharing_details",
      success: function () {
        console.log('跳转到news页面成功') // success              
      },
      fail: function () {
        console.log('跳转到news页面失败') // fail 
      }
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    var data = {
      "startPoint": 0,
      "maxPage": 1
    }
    var vm =this
    getApp().requestLoading(getApp().globalData.https + "programResource/shareProgram" ,
      "get", data, "加载中...",
      function (res) {
        if (res.code == 0) {
          console.log(res.data)
          
          vm.setData({
            shareList: res.data.result
          })


        }
      },
      function (res) {
        console.log(res)
      });


    var vm = this
    var animation = wx.createAnimation({
      duration: 500,
      timingFunction: 'ease-out',
    })

    this.animation = animation


    //点击图标 切换效果 ，通过动态改变两张图片的显隐性
    var inter = setInterval(function () {
      vm.setData({
        clickhide: !vm.data.clickhide
      })
    }, 250)


    //切换banner  右侧图片
    setInterval(function(){
      if(vm.data.imgindex==3){
        vm.setData({
          imgindex: 0
        })
        vm.setData({
          imgreal:vm.data.imglist[vm.data.imgindex]
        })
      }else{
        vm.setData({
          imgindex: vm.data.imgindex+1
        })
        vm.setData({
          imgreal: vm.data.imglist[vm.data.imgindex]
        })
      }
   
      animation.opacity(0.1)      
      animation.scale(0, 0).step({
        duration: 100,
      })
      animation.opacity(1) 
      animation.scale(1, 1).step()
      vm.setData({
        animationData: animation.export(),
      })
    },4000)
  },

  
  changeitem:function(){
    var vm=this
    this.setData({
      myshare: !vm.data.myshare,
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function() {

  }
})